/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.bean.User;
/*    */ import com.newcrm.db.CustomerManager;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.io.PrintWriter;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import net.sf.json.JSONObject;
/*    */ 
/*    */ public class DeleteCustomerAvatar extends AbstractAction
/*    */ {
/* 21 */   private int id = 0;
/* 22 */   private boolean isPerson = true;
/*    */ 
/*    */   public DeleteCustomerAvatar(AbstractHttpServlet servlet) {
/* 25 */     super(servlet);
/*    */   }
/*    */ 
/*    */   public DeleteCustomerAvatar(AbstractHttpServlet servlet, int id, boolean isPerson)
/*    */   {
/* 30 */     super(servlet);
/* 31 */     this.id = id;
/* 32 */     this.isPerson = isPerson;
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 38 */     response.setContentType("text/html;charset=utf-8");
/* 39 */     PrintWriter out = response.getWriter();
/* 40 */     User user = super.getLoginUser(request);
/*    */ 
/* 42 */     JSONObject jsonObject = new JSONObject();
/* 43 */     CustomerManager manager = new CustomerManager();
/*    */ 
/* 45 */     manager.updateImgPath(user.userId, this.id, "");
/* 46 */     jsonObject.put("error", "0");
/*    */ 
/* 48 */     if (this.isPerson)
/* 49 */       jsonObject.put("img", request.getContextPath() + "/" + 
/* 50 */         "images/avatar_person.png");
/*    */     else {
/* 52 */       jsonObject.put("img", request.getContextPath() + "/" + 
/* 53 */         "images/avatar_company.png");
/*    */     }
/*    */ 
/* 56 */     out.println(jsonObject);
/* 57 */     out.flush();
/* 58 */     out.close();
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.DeleteCustomerAvatar
 * JD-Core Version:    0.6.1
 */